<extend name="./Common/View/EasyUI/datagrid.html"/>

<block name="search">
    <table class="search-table table-condensed">
        <tr>
            <td>名称/代码</td>
            <td><input type="text" name="keyword" class="span2 input-text"></td>
            <td><a href="javascript:void(0);" id="btn_search" class="easyui-linkbutton"
                   data-options="plain:true,iconCls:'icon-search'">搜索</a>
                <a href="javascript:void(0);" id="btn_clear" class="easyui-linkbutton"
                   data-options="plain:true,iconCls:'icon-remove'">清空</a>
            </td>
        </tr>
    </table>
</block>

<block name="toolbar">
    <a onclick="curd.add( '添加角色')" href="javascript:void(0);" class="easyui-linkbutton"
       data-options="plain:true,iconCls:'icon-plus'">添加</a>
    <a onclick="curd.batch('enable')" href="javascript:void(0);" class="easyui-linkbutton"
       data-options="plain:true,iconCls:'icon-ok-circle'">启用</a>
    <a onclick="curd.batch('disable', '您确认要禁用这些角色吗？')" href="javascript:void(0);" class="easyui-linkbutton"
       data-options="plain:true,iconCls:'icon-remove-circle'">禁用</a>
    <a onclick="curd.reload();" href="javascript:void(0);" class="easyui-linkbutton"
       data-options="plain:true,iconCls:'icon-refresh'">刷新</a>
</block>

<block name="columns">
    <thead data-options="frozen:true">
    <tr>
        <th data-options="field:'id',checkbox:true"></th>
        <th data-options="field:'idField',width:120,formatter:format_operation">操作</th>
        <th data-options="field:'code',width:150,sortable:true">配置代码</th>
        <th data-options="field:'title',width:150">配置名称</th>
        <th data-options="field:'type',width:100,formatter:format_type">配置类型</th>
    </tr>
    </thead>
    <thead>
    <tr>
        <th data-options="field:'value'">值</th>
        <th data-options="field:'status',width:50,formatter:format_status">状态</th>
        <th data-options="field:'sort',width:50">排序</th>
    </tr>
    </thead>
</block>

<block name="script">
    <script>
        function format_operation(value, row, index) {
            return format_button(row.id, ['edit','delete']);
        }
        function format_type(value, row, index) {
            if(value == 'default') return '普通文本';
            if(value == 'datetime') return '日期时间';
            if(value == 'enum') return '枚举';
            if(value == 'text') return '长文字';
            if(value == 'file') return '文件';
            if(value == 'image') return '图片';
            if(value == 'url') return 'URL链接';
            if(value == 'number') return '数字';
        }
    </script>
</block>